//
//  HMBaseViewController.swift
//  sinaweibo
//
//  Created by Reality on 2017/6/29.
//  Copyright © 2017年 wangjing. All rights reserved.
//

import UIKit

class HMBaseViewController: UIViewController {

    // 判断是否登录
    let isLogin: Bool = false
    
    var visitorView: HMVisitorView?
    
    override func loadView() {
        if !isLogin {
            setupVisitorView()
        }else{
            // 用户登录了
            super.loadView()
        }
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

       setupNav()
    }
    
    private func setupVisitorView(){
    // 实例化HMVisitorView
    visitorView = HMVisitorView()
    view = visitorView
    setupNav()
    }
    
    //     监听事件
    @objc private func loginClick(){
        print("监听按钮点击弹出控制器gogogo")
    }
    private func  setupNav(){
        navigationItem.leftBarButtonItem = UIBarButtonItem(imgName: nil, title: "注册", target: self, action: #selector(loginClick))
        navigationItem.rightBarButtonItem = UIBarButtonItem(imgName: nil, title: "登录", target: self, action: #selector(loginClick))
    }
    

    


}
